package KK.Kernal
{
	import flash.utils.Dictionary;

	public class DataLinkage extends KeyValue
	{
		private const LinkageTable:Dictionary=new Dictionary(); 
		public function DataLinkage()
		{
			//TODO: implement function
			super();
			init();
		}
		private function init():void{
			
		}
		
		/**
		 * 绑定数据联动 
		 * @param key
		 * @param linkage
		 * 
		 */
		public function BindLinkage(key:String,linkage:Function):void{
			LinkageTable[key]=linkage;
		}
		
		override public function Set(key:String, value:String):void{
			super.Set(key,value);
			if(LinkageTable[key]){
				LinkageTable[key].apply(this,[value]);
			}
		}
		override public function SetInt(key:String, value:int):void{
			super.SetInt(key,value);
			if(LinkageTable[key]){
				LinkageTable[key].apply(this,[value]);
			}
		}
	}
}